Skip to main content

One Way Main-Renderer IPC

note

See the Electron-Documentation for a more indepth explanation of the reasons for, and how the IPC works between the Main process, the Renderer process, and why the preload step is required.

To Share Or Not To Share

Unlike typical Fable.Remoting, the entire stack is compiled to JavaScript, so there is no requirement to define your API types in a Shared project. You can choose to do this or not.

Example

The One-Way Main - Renderer IPC channel allows the Main electron process to communicate messages to a Renderer process.

To do so, you must pass the BrowserWindow's that you wish to be acted on to the RemotingConfig before building it. Failing to do so will cause an error to log to console (and incorrect behaviour).

The example below should log 'Move' when the browser window is moved.

Synchronous Signatures

Unlike the Two-Way IPC, the signatures for One-Way are treated synchronously.

type ExampleMainToRenderer = {
// Dummy parameter to demonstrate multi param functions
LogMove: string -> int -> unit
}
warning

The API for Fable.Electron.Remoting is highly likely to change according to user preference at the beginning.